#ifndef BINDKERNELARGS_H
#define	BINDKERNELARGS_H

#include <CL/cl.h>
#include "clUtils.h"
#include "ClMem.h"

struct BindKernelArgs {
	BindKernelArgs(cl_kernel _kernel) : kernel(_kernel), argIndex(0) {	}	
	
    template <class T>
    BindKernelArgs& operator << (const ClMem<T> &arg) {		
        cl_mem mem = arg;
        CL_CHECK(clSetKernelArg(kernel, argIndex++, sizeof(cl_mem), (void*)&mem));
        return *this;
    }
    
	template <class T>
    BindKernelArgs& operator << (const T& arg) {		
        CL_CHECK(clSetKernelArg(kernel, argIndex++, sizeof(T), (void*)&arg));
        return *this;
    }
	
private:
	cl_kernel kernel;
	cl_uint argIndex;
};

#endif	/* BINDKERNELARGS_H */

